package cn.daichi.redisidempotency.exception;

import cn.daichi.redisidempotency.base.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {

    /**
     * 幂等性异常处理
     */
    @ExceptionHandler(IdempotencyException.class)
    public Result idempotencyException(IdempotencyException e) {
        return Result.error(e.getMessage());
    }

}
